package com.atguigu.realtime.function;

import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

/**
 * @author chenlongStart
 * @create 2021-07-05 19:51
 * @desc
 */
@FunctionHint(output = @DataTypeHint("row<source string,ct bigint>"))
public class KwProduct extends TableFunction<Row> {
    public void eval(Long click_ct,Long order_ct,Long cart_ct){
        if (click_ct>0){
            collect(Row.of("click",click_ct));
        }
        if (order_ct>0){
            collect(Row.of("order",order_ct));
        }
        if (cart_ct>0){
            collect(Row.of("cart",cart_ct));
        }
    }
}
